﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TribesPSO
{
    /// <summary>
    /// A single threaded search space implementation that uses IndependantGaussian particles
    /// </summary>
    public sealed class SingleThreadedGaussianSearchSpace : SingleThreadedSearchSpace<IndependentGaussianParticle>
    {
        /// <summary>
        /// Creates a new Single-threaded gaussian search space to optimize the specified objective function
        /// </summary>
        /// <param name="objectiveFunction"></param>
        public SingleThreadedGaussianSearchSpace(IObjectiveFunction objectiveFunction)
            : base(objectiveFunction) { }

        /// <summary>
        /// Creates a new single threaded gaussian search space to optimize the specified objective function.
        /// The specified random number generator will be used to move the particles
        /// </summary>
        /// <param name="objectiveFunction">The IObjectiveFunction to solve</param>
        /// <param name="randomNumberGenerator">The random number generator that will be used to move the particles</param>
        public SingleThreadedGaussianSearchSpace(IObjectiveFunction objectiveFunction, IHyperspaceRandom randomNumberGenerator)
            : base(objectiveFunction, randomNumberGenerator) { }

        /// <summary>
        /// Creates a new IndependentGaussianParticle at the specified location and the SearchSpaces own IObjectiveFunction
        /// </summary>
        /// <param name="position">The initial location of the new particle</param>
        /// <returns>A new IndependentGaussianParticle</returns>
        protected override IndependentGaussianParticle GenerateParticleAtPosition(EuclidianVector position)
        {
            return new IndependentGaussianParticle(this.GoodnessFunction, position);
        }
    }
}
